package order.client;

import com.example.entity.Carrier;
import com.example.entity.Truck;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@FeignClient(value="carrier-service", fallback = CarrierFallbackClient.class)
public interface CarrierClient {

    @GetMapping("/getUnitPrice")  // 根据id获取单价
    Float getUnitPrice(@RequestParam(required = false,name = "carrierId") Long carrierId);

    @GetMapping("/selectTruckById")  // 根据id获取货车
    Truck selectTruckById(@RequestParam(required = false,name = "truckId") Long truckId);

    @PutMapping("/updateTruckById")  // 根据id更新货车状态
    void updateTruckById(@RequestBody Truck truck);

    @PutMapping("/updateDriverById")  // 更新司机状态
    void updateDriverState(@RequestParam(required = false,name = "state")Integer state,
                           @RequestParam(required = false,name = "carrierId")Long carrierId,
                           @RequestParam(required = false,name = "driverId")Long driverId);

}
